#!/bin/bash

# LASTOOLS (open-source part, i.e. no wine is required)
cd /opt/sw
wget http://www.cs.unc.edu/~isenburg/lastools/download/lastools.zip
unzip lastools.zip
cd LAStools/
make -j$threads
# Binaries will be found in the 'bin' directory.
# Recommended not to run 'make install' because most of lastools' executables have the same names as the liblas utilities.
# Add to paths
# export PATH="/opt/sw/LAStools/bin:$PATH"

# Postgres
sudo apt update
#sudo apt install postgresql postgresql-contrib
sudo apt install postgresql-server-dev-14 postgresql-14

sudo su postgres
psql
ALTER USER postgres WITH PASSWORD 'postgres';
CREATE USER picsad WITH PASSWORD 'picsad';
ALTER USER picsad WITH SUPERUSER;
CREATE DATABASE picsad;

sudo apt install libgdal-dev

# libpqxx
sudo apt install libpqxx-dev


# python
sudo apt install -y curl cmake libcunit1-dev autoconf automake g++ \
python-dev swig libjpeg-turbo8-dev libbz2-dev zlib1g-dev git libxml2-dev \
python-numpy libflann-dev libsqlite0-dev libopenmpi-dev subversion \
libcurl4-openssl-dev libxerces-c-dev unixodbc-dev libjson-c-dev libpcre3-dev \
ant libbison-dev gettext libtool libreadline-dev unzip libfreetype6 \
libfreetype6-dev libxslt1-dev python3-pip \
libgeos-dev libtiff-dev libgeotiff-dev libgdal-dev liblaszip-dev \
